/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package bgu.ppm.dat.view;

import bgu.ppm.dat.model.FilterField;

/**
 *
 * @author user
 */
public class FilterFieldValueSelectableItem extends SelecteableItem<Object> {
    private FilterField ff;
    
    public FilterFieldValueSelectableItem(FilterField ff, Object value) {
        super(value, false);
        this.ff = ff;
    }

    @Override
    public boolean isSelected() {
        return !ff.getRestrictedValues().contains(getItem());
    }

    @Override
    public void setSelected(boolean selected) {
        if (selected) {
            ff.allowValue(getItem());
        } else {
            ff.restrictValue(getItem());
        }
    }
    
}
